<template>
    <el-dialog
            class="dialog"
            :close-on-click-modal="false"
            :width="width"
            :title="title"
            :visible.sync="dialogFormVisible"
            append-to-body>
        <slot></slot>
        <div slot="footer" class="dialog-footer" v-if="footer">
            <el-button size="mini" type="primary" @click="submit">{{confirm}}</el-button>
            <el-button size="mini" @click="close">取 消</el-button>
        </div>
    </el-dialog>
</template>

<script>
    export default {
        data() {
            return {
                dialogFormVisible: false
            };
        },
        props: {
            footer: {
                default: true,
                type: Boolean
            },
            title: {
                default: "",
                type: String
            },
            width: {
                default: "500",
                type: [String, Number]
            },
            confirm: {
                default: "确 定",
                type: String
            }
        },
        methods: {
            close() {
                this.dialogFormVisible = false;
            },
            open() {
                this.dialogFormVisible = true;
            },
            submit() {
                this.$emit("dialogSubmit");
            }
        }
    };
</script>

<style lang="scss" scoped>
    .dialog /deep/ .el-dialog {

    .el-dialog__body {
        /*height: 500px; ???????*/
        overflow-y: auto;
    }

    }
</style>